<template>
<div class="self">
  <h1>This is an self page</h1>
  <h1 id="demo"></h1>
</div>
</template>

<script>
export default {
  name: 'User',
  activated () {
    window.addEventListener('pageshow', this.enterCall)
  },
  destroyed () {
    window.addEventListener('pagehide', this.leaveColl)
  },
  methods: {
    enterCall () {
      document.getElementById('demo').innerHTML = '欢迎来到我的主页!'
      console.log('enterCall')
    },
    leaveColl () {
      document.getElementById('demo').innerHTML = '欢迎下次光临'
      console.log('leaveColl')
    }
  }
}
</script>

<style lang="less" scoped>

</style>
